package com.xhl.doeverything.controller;

import com.xhl.doeverything.entity.ApiResult;
import com.xhl.doeverything.entity.StudentRequest;
import com.xhl.doeverything.service.StudentInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.io.IOException;

/**
 * @author xionghuilong
 * @description: 学生controller
 * @date 2021/12/3 14:12
 */
@RestController
@Slf4j
@Api(tags = "学生信息管理")
@RequestMapping("/studentInfo")
public class StudentController {

    @Resource
    private StudentInfoService studentInfoService;

    @PostMapping("add")
    @ApiOperation("添加学生")
    public ApiResult<String> add(@RequestBody StudentRequest request) throws IOException {

        this.studentInfoService.add(request);
        return ApiResult.success("入库完毕！");
    }
}
